<div id="content">
    <div class="row s_page_title">
        <sa-big-breadcrumbs [items]="['运输任务','审核异常[梵途]']" icon="fa fa-truck" class="col-xs-12 col-sm-7 col-md-7 col-lg-4"></sa-big-breadcrumbs>
    </div>
    <sa-widgets-grid>
        <div class="s_table">
            <div sa-widget [editbutton]="false" color="darken" class="clearfix">

                <header><span class="widget-icon"> <i class="fa fa-table"></i> </span>
                    <h2>审核异常[梵途]</h2>
                </header>
                <div>
                    <div class="widget-body no-padding">
                        <div class="page-header clearfix s_table_opreation">
                            <div class="left page-header-btn" style="width: calc(100% - 220px);">
                                <sa-company-tree-car companyTreeId="companyTree" (companySelected)="companySelected($event)"></sa-company-tree-car>
                                <div class="top_module">
                                    <span class="module_text">订单编号</span>
                                    <input class="module_inp" [(ngModel)]="orderCode" placeholder="请输入订单编号">
                                </div>
                                <div class="top_module">
                                    <span class="module_text">异常类型</span>
                                    <select name="" id="" class="module_inp" [(ngModel)]="exType">
                                        <option value="">全部</option>
                                        <option value="0">正常</option>
                                        <option value="1">流向异常</option>
                                        <option value="2">设备异常</option>
                                        <option value="3">数据异常</option>
                                      </select>
                                </div>
                                <div class="top_module">
                                    <span class="module_text">时间类型</span>
                                    <select name="" id="" class="module_inp" [(ngModel)]="dType">
                                        <option value="1">进厂时间</option>
                                        <option value="2">出厂时间</option>
                                        <option value="3">创建时间</option>
                                      </select>
                                </div>
                                <div class="selectDate top_module">
                                    <table-select-date [notInit]='true' [specifyTime]="InputTime" (outerTime)="getSelectTableTime($event)"></table-select-date>
                                </div>
                                <div class="top_module">
                                    <span class="module_text">推送状态</span>
                                    <select name="" id="" class="module_inp" [(ngModel)]="isPush">
                                        <option value="">全部</option>
                                        <option value="0">未推送</option>
                                        <option value="1">已推送</option>
                                      </select>
                                </div>


                                <button type="button" class="btn btn-primary" (click)="table_search()">查询</button>
                                <button type="button" class="btn btn-primary" (click)="pushAll()">批量推送</button>
                            </div>
                            <!-- <div class="right top-search">
								<input type="text" [(ngModel)]="searchKey" (change)="table_search()" class="search-input" placeholder="车牌,设备ID,描述,处理人...">
								<span class="top-search-box">
							        <button class="top-search-btn" type="button" (click)="table_search()"> <i class="fa fa-search"></i></button>
							    </span>
							</div> -->
                        </div>
                        <div class="table_scroll">
                            <table class="display dataTables responsive table table-striped table-bordered table-hover dataTable s_h5_table">
                                <thead>
                                    <tr>
                                        <th>
                                            <div class="checkbox" style="margin:0;left: 5px;text-align: center;">
                                                <label>
                                                  <input type="checkbox" class="checkbox style-0" [(ngModel)]="allChecked" (click)="allSelected()">
                                                  <span></span>
                                                </label>
                                            </div>
                                        </th>
                                        <th>订单编号</th>
                                        <th>公司名称</th>
                                        <th>车牌号码</th>
                                        <th>设备ID</th>
                                        <th>进厂时间</th>
                                        <th>出厂时间</th>
                                        <th>订单重量</th>
                                        <th>过磅重量</th>
                                        <th>创建时间</th>
                                        <th>订单状态</th>
                                        <th>完成状态</th>
                                        <th>处理人</th>
                                        <th>处理状态</th>
                                        <th>处理时间</th>
                                        <th>处理意见</th>
                                        <th>是否推送</th>
                                        <th>推送结果</th>
                                        <th>推送时间</th>
                                        <th>异常信息</th>
                                        <th>异常订单备注</th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr *ngFor="let row of tableData; let i = index" [attr.data-index]="i" [ngClass]="{selected:activeSelected === row.id}">
                                        <td>
                                            <div class="checkbox" style="margin:0;left: 5px;text-align: center;">
                                                <label>
                                                  <input type="checkbox" class="checkbox style-0" [(ngModel)]="row.isChecked" (click)="rowSelected(row,$event,i)">
                                                  <span></span>
                                                </label>
                                            </div>
                                        </td>
                                        <td>{{row.orderCode}}</td>
                                        <td>{{row.companyName}}</td>
                                        <td>{{row.carNumber}}</td>
                                        <td>{{row.deviceId}}</td>
                                        <td>{{row.inTime}}</td>
                                        <td>{{row.outTime}}</td>
                                        <td>{{row.weight}}</td>
                                        <td>{{row.nWeight}}</td>
                                        <td>{{row.createTime}}</td>
                                        <td>
                                            <span *ngIf="row.checkStatus == '0'">运输中</span>
                                            <span *ngIf="row.checkStatus == '2'">未清零[进厂]</span>
                                            <span *ngIf="row.checkStatus == '3'">未识别上货</span>
                                            <span *ngIf="row.checkStatus == '4'">重量突增</span>
                                            <span *ngIf="row.checkStatus == '5'">卸货未清零</span>
                                            <span *ngIf="row.checkStatus == '6'">设备离线</span>
                                            <span *ngIf="row.checkStatus == '7'">系统误判</span>
                                            <span *ngIf="row.checkStatus == '8'">垂直卸货</span>
                                            <span *ngIf="row.checkStatus == '9'">地磅问题</span>
                                            <span *ngIf="row.checkStatus == '10'">订单异常</span>
                                            <span *ngIf="row.checkStatus == '11'">卸货有速度</span>
                                        </td>
                                        <td>
                                            <span *ngIf="row.orderStatus == '0'">运输中</span>
                                            <span *ngIf="row.orderStatus == '1'">卸货完成</span>
                                        </td>
                                        <td>{{row.detailUserName}}</td>
                                        <td>
                                            <span *ngIf="row.detailStatus == '0'" class="orange">待处理</span>
                                            <span *ngIf="row.detailStatus == '1'" class="green">人工处理</span>
                                            <span *ngIf="row.detailStatus == '2'" class="green">算法处理</span>
                                            <span *ngIf="row.detailStatus == '3'" class="green">无异常</span>
                                        </td>
                                        <td>{{row.detailTime}}</td>
                                        <td>{{row.detailMessage}}</td>
                                        <td>
                                            <span *ngIf="row.isPush == '0'" class="orange">未推送</span>
                                            <span *ngIf="row.isPush == '1'" class="green">已推送</span>
                                        </td>
                                        <td>
                                            <span *ngIf="row.pushRes == '0'" class="red">推送失败</span>
                                            <span *ngIf="row.pushRes == '1'" class="green">推送成功</span>
                                        </td>
                                        <td>{{row.pushTime}}</td>
                                        <td>{{row.exTypeDesc}}</td>
                                        <td>{{row.errorMessage}}</td>
                                        <td>
                                            <!-- <button type="button" (click)="checkAbnormal(row)" >查看</button> -->
                                            <!-- <button type="button" (click)="runMatlab(row,runMatlabModal)" >手动执行算法</button> -->
                                            <button type="button" (click)="pushItem(row)">推送</button>
                                            <!--<button type="button" (click)="jumpOptimization(row)" >修复</button>-->
                                            <!-- <button type="button" (click)="delete_row(row)" >删除</button> -->
                                            <!-- <button type="button" (click)="jumpOrderManagenment(row)" >修复</button> -->
                                        </td>

                                    </tr>
                                </tbody>
                            </table>
                        </div>
                        <div class="table-fix clearfix">
                            <paginator [totalRecords]="totalCount" [rows]="pageSize" [currentPage]="curPage - 1" (onPageChange)="paginate($event)">
                            </paginator>
                            <button type="button" class="btn default refresh_btn" (click)="refresh()"><i class="fa fa-refresh"></i></button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </sa-widgets-grid>
    <!--折线图-->
    <div style="background: white;border-radius: 5px;margin-top: 5px;position: relative;" [hidden]='!isChartView'>
        <button (click)="closeChart()" class="div_closeBtn"> × </button>
        <div class="widget-body no-padding" style="margin: 0;">
            <div class="page-header clearfix s_table_opreation" style="margin: 0;">
                <div class="left page-header-btn" style="padding: 5px;">
                    <div class="top_module">
                        <span class="module_text" style="background: none;">异常数据折线图</span>
                    </div>
                    <div style="display: inline-block;">
                        <div>
                            <div class="selectDate top_module">
                                <table-select-date [notInit]='true' [specifyId]='specifyId' [specifyTime]='specifyTime' (outerTime)="getSelectChartTime($event)"></table-select-date>
                            </div>
                            <button type="button" class="btn btn-primary" (click)="drawAbnormalChart()">查看</button>
                            <!--<button type="button" class="btn btn-primary" *ngIf="checkQuanxian&&quickAudit" (click)="modalCheckEvent();" >快速审核</button>-->
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <sa-chart-bmap [height]='325' [inputParams]='selectedRow' [isBaiduMap]='true' (outerSend)="runParent($event)" (outerIsMap)='showMapView($event)' [isAuditData]='false' [isShowModify]='true'></sa-chart-bmap>
        <div [hidden]='!isMapView'>
            <sa-bmap-chart [trackParams]='drawTrackArr' [isShowBmap]='isMapView' deviceId="deviceId"></sa-bmap-chart>
        </div>
    </div>

    <!--  手动执行算法弹窗-->
    <div bsModal #runMatlabModal="bs-modal" id="lgModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" (click)="runMatlabCancel(runMatlabModal)" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title">手动执行算法</h4>
                </div>
                <div class="modal-body">
                    <div class="row form-horizontal">
                        <form class="form" role="form">
                            <div class="row">

                                <div class="form-group clearfix col-sm-12">
                                    <label class="control-label col-sm-2 no-padding-right">上货前置零</label>
                                    <div class="col-sm-9">
                                        <div class="clearfix">
                                            <input class="form-control" name="datePicker1" type="text" id="datePicker1" [ngModel]="zeroBeforeDate" placeholder="上货前置零时间[默认空磅时间]" />
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group clearfix col-sm-12">
                                    <label class="control-label col-sm-2 no-padding-right">卸货后置零</label>
                                    <div class="col-sm-9">
                                        <div class="clearfix">
                                            <input class="form-control" name="datePicker2" type="text" id="datePicker2" [ngModel]="zeroAfterDate" placeholder="卸货后置零时间" />
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" (click)="runMatlabCancel(runMatlabModal)">取消</button>
                    <button type="button" class="btn btn-primary" (click)="runMatlabConfirm(runMatlabModal)">确认</button>
                </div>
            </div>
        </div>
    </div>
    <!--弹窗end-->

</div>